//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package study.IO.字符流.Writer;

import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;

public class OutputStreamWriter_demo {
    public OutputStreamWriter_demo() {
    }

    public static void main(String[] args) throws IOException {
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("JavaTest\\Files\\a-copy.txt"), "GBK");
        osw.write("这是gbk的编码格式");
        osw.flush();
        osw.write("这是gbk编码文件的第二句");
        osw.close();
        FileWriter fw = new FileWriter("JavaTest\\Files\\a-copy.txt", Charset.forName("GBK"), true);
        fw.write("这是用FileWriter写入的GBK字符");
        fw.close();
    }
}
